home *** CD-ROM | disk | FTP | other *** search
-
- function units_bomber_select()
- units_select(12)
- uniGetExecutor():addSimpleEffect(ENET_EFFECT_PS_ENVIRONMENT_SPOTLIGHT_RED4)
- end
-
- function units_bomber_unselect()
- units_unselect()
- uniGetExecutor():addSimpleEffect(ENET_EFFECT_PS_ENVIRONMENT_SPOTLIGHT_RED4)
- end
-
- function units_bomber_selectenemy()
- uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
- end
-
- function units_bomber_damaged()
- uniGetExecutor():applyDamage(uniGetLife())
- end
-
- function units_bomber_highlight()
- uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
- end
-
- function units_bomber_setup()
- local bomber = uniGetExecutor()
- bomber:setTransformOwner(units_findfreefirespot(uniGetTarget(),1))
- bomber:addSimpleEffect(ENET_EFFECT_PS_ENVIRONMENT_SPOTLIGHT_GREEN4):setLocalPosition(-7,4,-10)
- bomber:addSimpleEffect(ENET_EFFECT_PS_ENVIRONMENT_SPOTLIGHT_GREEN4):setLocalPosition(7,4,-10)
-
- bomber:setLocalPosition(0,0,0)
- units_reloadfirespots(bomber,1,ENET_EFFECT_BULLET_BOMB)
- bomber:resetAnimations()
- bomber:setVisibility(true,true)
- bomber:addSimpleEffect(ENET_EFFECT_BOUNDEDTEXT)
- bomber:addSimpleEffect(ENET_EFFECT_GEOMETRY_AIRSHADOW2)
- end
-
- function units_bomber_fire()
- local unit = uniGetExecutor()
- local base = unit:getTransformOwner()
- local target = uniGetTarget()
-
- uniSetLife(uniGetLife() / 4.0)
-
- local holders = {}
- holders[0] = enHolder:new(target)
- holders[1] = enHolder:new(base,HT_CARGOSPACE)
-
- unit:setTransformOwner()
-
- local enginePS = {}
- enginePS[0] = unit:getBone(ENBT_STEPEMITTER,0):addSimpleEffect(ENET_EFFECT_PS_AIRTRAY)
- enginePS[1] = unit:getBone(ENBT_STEPEMITTER,1):addSimpleEffect(ENET_EFFECT_PS_AIRTRAY)
- enginePS[2] = unit:addSimpleEffect(ENET_EFFECT_PS_AIRENGINE)
-
- unit:addAnimationToQueue(ENAT_PREPAREFORFIRE1,1)
- unit:addAnimationToQueue(ENAT_GO,MATH_INFINITY)
-
- local sound = unit:play3DSound("air_move.wav",1)
-
- waitDeath(unit:addMoveEffect(ENET_EFFECT_MOVE_AIRSMOOTH,100,uniGetTarget()))
-
- local firespots = {}
- firespots[0] = unit:getBone(ENBT_FIRE1,0)
- firespots[1] = unit:getBone(ENBT_FIRE1,1)
-
- local mover = unit:addMoveEffect(ENET_EFFECT_MOVE_AIRSMOOTH,100,base)
- holders[3] = enHolder:new(mover);
-
- firespots[0]:findEffect(ENET_EFFECT_BULLET_BOMB):executeCommand(ENC_FIRE1)
- pause(0.1)
- firespots[0]:addSimpleEffect(ENET_EFFECT_BULLET_BOMB)
- firespots[1]:findEffect(ENET_EFFECT_BULLET_BOMB):executeCommand(ENC_FIRE1)
- pause(0.1)
- firespots[1]:addSimpleEffect(ENET_EFFECT_BULLET_BOMB)
- firespots[0]:findEffect(ENET_EFFECT_BULLET_BOMB):executeCommand(ENC_FIRE1)
- pause(0.1)
- firespots[0]:addSimpleEffect(ENET_EFFECT_BULLET_BOMB)
- firespots[1]:findEffect(ENET_EFFECT_BULLET_BOMB):executeCommand(ENC_FIRE1)
- pause(0.1)
- firespots[1]:addSimpleEffect(ENET_EFFECT_BULLET_BOMB)
-
- waitDeath(mover)
-
- enginePS[0]:suspendedDestroy(2.0);
- enginePS[1]:suspendedDestroy(2.0);
- enginePS[2]:suspendedDestroy(0.5);
-
- waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_AIRHORIZONTALORIENT,1.57))
- unit:setCurrentAnimationRepeatCount(1)
- unit:addAnimationToQueue(ENAT_AFTERFIRE1,1)
- waitDeath(unit:addMoveEffect(ENET_EFFECT_MOVE_LINEARFLYTOOWNER,100,base))
-
- unit:setTransformOwner(base)
- sound:destroy()
-
- unit:addFireArrow()
- end
-
- function units_bomber_move()
- local bomber = uniGetExecutor()
- bomber:setTransformOwner()
- local holder = enHolder:new(uniGetTarget())
- local base = units_findfreefirespot(uniGetTarget(),1)
- local placeHolder = enHolder:new(base,HT_CARGOSPACE)
-
- local enginePS = {}
- enginePS[0] = bomber:getBone(ENBT_STEPEMITTER,0):addSimpleEffect(ENET_EFFECT_PS_AIRTRAY)
- enginePS[1] = bomber:getBone(ENBT_STEPEMITTER,1):addSimpleEffect(ENET_EFFECT_PS_AIRTRAY)
- enginePS[2] = bomber:addSimpleEffect(ENET_EFFECT_PS_AIRENGINE)
-
- bomber:addAnimationToQueue(ENAT_PREPAREFORFIRE1,1)
- bomber:addAnimationToQueue(ENAT_GO,MATH_INFINITY)
-
- local sound = bomber:play3DSound("air_move.wav",1)
-
- waitDeath(bomber:addMoveEffect(ENET_EFFECT_MOVE_AIRSMOOTH,100,base))
-
- sound:destroy()
- bomber:play3DSound("air_stop.wav",0):destroy()
-
- enginePS[0]:suspendedDestroy(2.0);
- enginePS[1]:suspendedDestroy(2.0);
- enginePS[2]:suspendedDestroy(0.5);
-
- waitDeath(bomber:addRotationEffect(ENET_EFFECT_ROTATE_AIRHORIZONTALORIENT,1.57))
- bomber:setCurrentAnimationRepeatCount(1)
- bomber:addAnimationToQueue(ENAT_AFTERFIRE1,1)
- waitDeath(bomber:addMoveEffect(ENET_EFFECT_MOVE_LINEARFLYTOOWNER,100,base))
- bomber:setTransformOwner(base)
- end
-
- function units_bomber_explode()
- local bomber = uniGetExecutor()
- bomber:setTransformOwner()
- bomber:play3DSound("bigunitexplode.wav",0):destroy()
- local ps_explode = bomber:addSimpleEffect(ENET_EFFECT_PS_BOMBEREXPLODE)
- ps_explode:setTransformOwner()
- pause(0.5)
- bomber:setVisibility(false,false)
- pause(0.5)
- ps_explode:suspendedDestroy(6.5)
-
- end
-
- registerCommand(ENSCRIPTSET_BULLET_AIR,ENC_SETUP,"units_bomber_setup")
- registerCommand(ENSCRIPTSET_BULLET_AIR,ENC_RESETUP,"units_bomber_setup")
- registerCommand(ENSCRIPTSET_BULLET_AIR,ENC_FIRE1,"units_bomber_fire")
- registerCommand(ENSCRIPTSET_BULLET_AIR,ENC_FIRE2,"units_bomber_fire")
- registerCommand(ENSCRIPTSET_BULLET_AIR,ENC_MOVE,"units_bomber_move")
- registerCommand(ENSCRIPTSET_BULLET_AIR,ENC_EXPLODE,"units_bomber_explode")
- registerCommand(ENSCRIPTSET_BULLET_AIR,ENC_SELECT,"units_bomber_select")
- registerCommand(ENSCRIPTSET_BULLET_AIR,ENC_SELECTENEMY,"units_bomber_selectenemy")
- registerCommand(ENSCRIPTSET_BULLET_AIR,ENC_UNSELECT,"units_bomber_unselect")
- registerCommand(ENSCRIPTSET_BULLET_AIR,ENC_DAMAGED,"units_bomber_damaged")
- registerCommand(ENSCRIPTSET_BULLET_AIR,ENC_HIGHLIGHT,"units_bomber_highlight")
-
-
- -- make description of unit
- desc = getEffectDescriptionP(ENET_UNIT_AIR)
- desc.ClassID = ENCLASS_MESHINSTANCE
- desc.EffectClassType = ENECT_GEOMETRY
- desc.FileName = "air.rmd"
- desc.ScriptSet = ENSCRIPTSET_BULLET_AIR
- desc.MoveType = ENMOVE_FLY
- desc.RenderType = ENRENDERTYPE_GEOMETRY
- desc.Material = ENMAT_RIGIDSKINNEDMESH
- desc.MaterialColors = units_materialcolors_human
-
- -- shadow
- desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_AIRSHADOW2)
- desc.ClassID = ENCLASS_MESHINSTANCE
- desc.EffectClassType = ENECT_GEOMETRY
- desc.FileName = "air_shadow.rmd"
- desc.RenderType = ENRENDERTYPE_SHADOW
- desc.Material = ENMAT_SHADOW
- desc.MaterialColors = units_materialcolors_shadow
-
- -- register new unit to logic
- unitDesc = logic_getUnitDescP(11)
- unitDesc.group = 2
- unitDesc.order = 4
- unitDesc.unit_res_id = ENET_UNIT_AIR
- unitDesc.unit_icon_id = "Air_h_small_normal.dds"
- unitDesc.active_id = "Air_h_small_active.dds"
- unitDesc.pressed_id = "Air_h_small_pressed.dds"
- unitDesc.big_icon_id = "Air_h_big_normal.dds"
- unitDesc.small_icon_id = "Fighter_u_stats.dds"
- unitDesc.HP = 1
- unitDesc.MP = 120
- unitDesc.WR = 6
- unitDesc.min_WR = 1
- unitDesc.WD = 1
- unitDesc.WR2 = 0
- unitDesc.min_WR2 = 0
- unitDesc.WD2 = 0
- unitDesc.ability = 4
- unitDesc.transport = 0
- unitDesc.value = 3
- unitDesc.race = 0
- unitDesc.fire_pause = 10.0
- unitDesc.move_pause = 10.0
- unitDesc.unit_info_scale = 0.10
- unitDesc.scn_name = "AIR"
-
- ------------------------------------------------------------------------------------------------------
- ------------------------ effects related to unit------------------------------------------------------
- ------------------------------------------------------------------------------------------------------
-
- function bullets_bomb_fire()
- local bullet = uniGetExecutor()
- bullet:setTransformOwner()
- local sound = bullet:play3DSound("air_bomb_fly.wav",0)
- waitDeath(bullet:addMoveEffect(ENET_EFFECT_MOVE_FALLTOGROUND,100,uniGetTarget()),100)
- sound:destroy()
- bullet:setVisibility(false,true)
- local hitType = bullet:getLastMovementEndType();
- if(hitType == ENBHT_DIRECTHIT) then
- bullet:addSimpleEffect(ENET_EFFECT_PS_BATTLESHIPSHOTHIT):suspendedDestroy(2.0)
- bullet:play3DSound("air_bomb_directhit.wav",0):destroy()
- elseif(hitType == ENBHT_GROUNDHIT) then
- bullet:addSimpleEffect(ENET_EFFECT_PS_BOMB_EARTHHIT):suspendedDestroy(2.0)
- bullet:play3DSound("air_bomb_earthhit.wav",0):destroy()
- elseif(hitType == ENBHT_WATERHIT) then
- bullet:addSimpleEffect(ENET_EFFECT_PS_BOMB_WATERHIT):suspendedDestroy(2.0)
- bullet:play3DSound("air_bomb_waterhit.wav",0):destroy()
- end
- uniGetTarget():executeCommand(ENC_DAMAGED)
- pause(2.0)
- bullet:destroy()
- end
-
- registerCommand(ENSCRIPTSET_BULLET_BOMB,ENC_FIRE1,"bullets_bomb_fire")
-